#!python3

import os, re

abspath = os.path.abspath('test')
fileList = os.listdir(abspath)
for file in fileList:
    print('+++Search from file %s'%file)
    fileHandler = open(abspath + os.path.sep + file)
    lines = fileHandler.readlines()
    for line in lines:
        if re.compile('search').search(line) != None:
            if line.endswith('\n'):
                print(line, end='')
            else:   
                print(line)